﻿$(document).ready(function () {
    $("ul#booklisting li, section#searchbar a.cancel, #bookinfo a.buynow, header a.goback").click(function () {
        $(this).addClass("active");
    });
    $(".sortable ul li a").click(function () {
        $(".sortable ul li a").removeClass("active");
        $(this).addClass("active");
    });
    $("#bookinfo a.buynow").click(function () {
        $(this).addClass("active");
        confirm("Are you sure you want to buy this book? Your credit card will be charged.");
    });
    $("#billinginfo section section").click(function () {
        $("input", this).focus().addClass("focus");
    });
    $('form#billinginfo').submit(function (event) {
        $(this).hide();
        $("#loading").show();
        setTimeout("window.location.href='bookinfo.html'", 3000);
        return false;
    });
    // Search ebooks.com
    searchEB = "Search eBooks.com";
    $("#searchApp").focus(function () {
        if ($(this).val() == searchEB) {
            $(this).val("");
        }
    }).blur(function () {
        if ($(this).val() == "") {
            $(this).val(searchEB);
        }
    });
    $("section#searchbar a.clearfield").click(function () {
        $("#searchApp").val("").focus();
    });
});
